subroutine r2abij_t2efij_iefab_ri(r2, t2, &
              icore, fact, rivv)
!
use mod_ri
use mod_size
use mod_iop
use mod_orbit
use mod_ioff 
implicit none
!
real*8, intent(in) :: fact
real*4, intent(in) :: r2(*)
!
real*4, intent(inout) :: t2(*), icore(*), rivv(*)
!
integer :: i, j, a, b, nsize, i0, i1, itmp0, itmp1, itmp2
integer, external :: idsymsoc
real*8, external :: dnrm2, nrm2so
!this is to do r2 = r2 + 0.5*t2(efij)*iefab
itmp0 = 1
itmp1 = itmp0 + nioiri_vv1*isd
itmp2 = itmp1 + nioiri_vv2*isd
i0 = itmp2
i0 = 1 
i1 = i0 + nvvoo*isd
! AAAA
 call VmnpqVmnrs_to_Vpqrs_uri_vv2(t2(ioi3(1)), icore(i1), 1, 1, vrta, vrta, 0, &
                popa, popa, 0, vrta, vrta, 0, icore(i0), 1, 1.d0, 0.d0, & 
                rivv(ioiri_vv(1)), rivv(ioiri_vv(1)), 1) 
call itranspso(icore(i0), icore(i1), popa, popa, 0, vrta, vrta, 0, 1) 
call axpyso(nioi31, fact*2.d0, icore(i1), 1, r2(ioi3(1)), 1)
! ABAB  
call VmnpqVmnrs_to_Vpqrs_uri_vv2(t2(ioi3(2)), icore(i1), 1, 1, vrta, vrtb, 1, &
               popa, popb, 1, vrta, vrtb, 1,  icore(i0), 1, 1.d0, 0.d0, &
               rivv(ioiri_vv(1)), rivv(ioiri_vv(2)), 3) 
call itranspso(icore(i0), icore(i1), popa, popb, 1, vrta, vrtb, 1, 1) 
call axpyso(nioi32, fact*2.d0, icore(i1), 1, r2(ioi3(2)), 1)
! BBBB    
 call VmnpqVmnrs_to_Vpqrs_uri_vv2(t2(ioi3(3)), icore(i1), 1, 1, vrtb, vrtb, 0, &
                popb, popb, 0, vrtb, vrtb, 0, icore(i0), 1, 1.d0, 0.d0, &
                rivv(ioiri_vv(2)), rivv(ioiri_vv(2)), 2) 
call itranspso(icore(i0), icore(i1), popb, popb, 0, vrtb, vrtb, 0, 1) 
call axpyso(nioi33, fact*2.d0, icore(i1), 1, r2(ioi3(3)), 1)
!
return
end
